package cn.meomis.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.meomis.common.entity.Pagination;
import cn.meomis.dao.ValueDetailDao;
import cn.meomis.model.ValueDetail;
import cn.meomis.service.ValueDetailService;

@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class ValueDetailServiceImpl implements ValueDetailService {

	@Autowired 
    private ValueDetailDao valueDetailDao;

    @Override
    public List<ValueDetail> findAll() {
    	return valueDetailDao.getAll();
    }
    
    @Override
    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public void save(ValueDetail demo) {
    	valueDetailDao.save(demo);
    }
    
    @Override
    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public void removeById(Integer id) {
    	ValueDetail demo = valueDetailDao.findById(id);
    	valueDetailDao.delete(demo);
    }

	@Override
	public Pagination pageQueryByHql(String hql, Object[] values,
			String countHql, int pageNumber, int pageSize) {
		return valueDetailDao.pageQueryByHql(hql, values, countHql, pageNumber, pageSize);
	}

	@Override
	public List<ValueDetail> queryListByProperty(String propertyName, Object value) {
		return valueDetailDao.queryListByProperty(propertyName, value);
	}

	@Override
	public List<ValueDetail> queryList(DetachedCriteria criteria) {
		return valueDetailDao.queryListBycriteria(criteria);
	}

	@Override
	public ValueDetail findById(int parseInt) {
		return valueDetailDao.findById(parseInt);
	}
}
